//
//  xingchengItems.m
//  qulvyou
//
//  Created by mmyy on 15/10/20.
//  Copyright (c) 2015年 mmyy. All rights reserved.
//

#import "xingchengItems.h"

@implementation xingchengItems

+(instancetype)xingchengItemsWithDic:(NSDictionary *)dict
{
    xingchengItems *items = [[xingchengItems alloc] init];
    items.avatar_l = [[dict objectForKey:@"user"] objectForKey:@"avatar_l"];
    items.name = [[dict objectForKey:@"user"] objectForKey:@"name"];
    items.lname = [dict objectForKey:@"name"];
    items.first_day = [dict objectForKey:@"first_day"];
    items.day_count = [dict objectForKey:@"day_count"];
    items.mileage = [dict objectForKey:@"mileage"];
    items.shared = [dict objectForKey:@"shared"];
    items.waypoints = [NSMutableArray arrayWithCapacity:0];
    NSArray *days = [dict objectForKey:@"days"];
    for (NSDictionary *item in days) {
        NSArray *waypoint = [item objectForKey:@"waypoints"];
        NSMutableArray *waypoints = [NSMutableArray arrayWithCapacity:0];
        for (NSDictionary *models in waypoint) {
            WayPoints *point = [WayPoints WayPointsWithDic:models];
            [waypoints addObject:point];
        }
        [items.waypoints addObject:waypoints];
    }
    return items;

}


@end
